package com.lancoo.ccas52.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.lancoo.ccas52.entity.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lancoo.ccas52.pojo.common.PageInfo;
import com.lancoo.ccas52.pojo.vo.*;

import java.util.List;
import java.util.Set;

/**
 * <p>
 * 课程 服务类
 * </p>
 *
 * @author quin.song
 * @since 2022-12-30
 */
public interface CourseService extends IService<Course> {

    /**
     * 获取课程/环节类别
     * @param taskId
     * @param flag 1：课程  2：环节
     * @return
     */
    List<CourseTypeDto> getCourseTypeByTaskId(Integer taskId, Integer flag);

    void syncCourse(Integer taskId, Set<Course> courses);

    void syncSegment(Integer taskId,Set<Segment> syncSegment);

    /**
     * 获取课程开课计划列表
     * @param taskId
     * @param page
     * @param applyStatus
     * @param courseTypeId
     * @param courseNature
     * @param collegeId
     * @param keyWord
     * @return
     */
    ApplyStatistics<CourseApplyDto> getCourseDtoByConditions(Integer taskId, IPage page, Integer applyStatus, String courseTypeId, Integer courseNature,Integer majorProp,  String collegeId, String keyWord);

    /**
     * 获取环节开课计划列表
     * @param taskId
     * @param page
     * @param applyStatus
     * @param segmentTypeId
     * @param collegeId
     * @param keyWord
     * @return
     */
    ApplyStatistics<SegmentDto> getSegmentDtoByConditions(Integer taskId, IPage page, Integer applyStatus, String segmentTypeId, String collegeId, String keyWord);

    /**
     * 课程申请相关
     * @param taskId
     * @param userId
     * @param userName
     * @param courseApplyInput
     * @return
     */
    CourseApply dealCourseApply(Integer taskId, String userId, String userName, CourseApplyInput courseApplyInput);

    /**
     * 环节申请相关
     * @param taskId
     * @param userId
     * @param userName
     * @param segmentApplyInput
     * @return
     */
    SegmentApply dealSegmentApply(Integer taskId, String userId, String userName, SegmentApplyInput segmentApplyInput);

    /**
     * 获取未启用的课程列表
     * @param taskId
     * @param courseTypeId
     * @param courseNature
     * @param collegeId
     * @param keyWord
     * @return
     */
    List<AddCourseSegment> getNotEnableCourseList(Integer taskId, String courseTypeId, Integer courseNature,Integer majorProp, String collegeId, String keyWord);

    /**
     * 获取未启用的环节列表
     * @param taskId
     * @param collegeId
     * @param keyWord
     * @return
     */
    List<AddCourseSegment> getNotEnableSegmentList(Integer taskId,String collegeId, String keyWord);
    /**
     * 审核
     * @param flag
     * @param examine
     * @param applyId
     * @param reviewComment
     * @return
     */
    boolean examineApply(Integer flag,Integer examine,Integer applyId,String reviewComment);

    /**
     * 待发布课程 环节统计
     * @param taskId
     * @return
     */
    PublishStatistics getPublishStatistics(Integer taskId);

    /**
     * 校验发布数据是否正确
     * @param taskId
     * @return
     */
    boolean checkPublishPlan(Integer taskId);

    /**
     * 将申请的数据填充到实际课程/环节中
     * @param taskId
     * @return
     */
    boolean publishPlan(Integer taskId);


    /**
     * 获取教学计划&课程&课程设置相关参数
     * @param taskId
     * @param page
     * @param studyNature
     * @param courseTypeId
     * @param courseNature
     * @param collegeId
     * @param keyWord
     * @param state
     * @return
     */
    PageInfo<CoursePlanDto> getCoursePlanAndCourseWeek(Integer taskId, IPage page, Integer studyNature, String courseTypeId, Integer courseNature,Integer majorProp, String collegeId, String keyWord,Integer uniqueShiftSign, Integer state);

    /**
     * 设置课程参数
     * @param weekInput
     * @return
     */
    CourseWeek setCourseWeek(WeekInput weekInput);

    /**
     * 判断该课程是否存在设置教室的教学班.true 存在 false 不存在
     * @param courseId
     * @param studyNature
     * @return
     */
    boolean isExistRoom( Long courseId, Integer studyNature,Integer hourType);

    /**
     * 返回设置课程参数 是单周|双周
     * @param taskId
     * @return 1：单周 2：双周
     */
    Integer oddEvenWeekStatistics(Integer taskId);

    /**
     * 设置教学班参数
     * @param teachingClassWeek
     * @return
     */
    TeachingClassWeek setTeachingClassWeek(TeachingClassWeek teachingClassWeek);

    /**
     * 设置环节参数
     * @param segmentWeek
     * @return
     */
    SegmentWeek setSegmentWeek(SegmentWeek segmentWeek);


    /**
     * 初始化教学班参数-所属教学班属于同一教学计划统一课程
     * @param teachingClassList
     */
    void initTeachingClassWeek(List<TeachingClass> teachingClassList);

    /**
     * 更新教学班对应的教室
     * @param teachingClassInputs
     */
    void updateTeachingClassWeek(List<TeachingClassInput> teachingClassInputs);


    /**
     * 获取课程 &教学班数量
     * @param taskId
     * @param page
     * @param studyNature
     * @param courseTypeId
     * @param courseNature
     * @param collegeId
     * @param keyWord
     * @param state
     * @return
     */
    PageInfo<CoursePlanDto> getCoursePlanAndTeachingClass(Integer taskId, IPage page, Integer studyNature, String courseTypeId, Integer courseNature,Integer majorProp, String collegeId, String keyWord, Integer state,Integer teachingClassType,Integer uniqueShiftSign);

    /**
     * 获取环节&教学班数量
     * @param taskId
     * @param page
     * @param studyNature
     * @param segmentTypeId
     * @param collegeId
     * @param keyWord
     * @param state
     * @return
     */
    PageInfo<SegmentPlanDto> getSegmentPlanAndTeachingClass(Integer taskId, IPage page, Integer studyNature, String segmentTypeId,  String collegeId, String keyWord, Integer state);

    /**
     * 教学任务统计
     * @param taskId
     * @return
     */
    TeachingTaskStatistics teachingTaskStatistics(Integer taskId);

}
